﻿using LPLS.Commons.Enums.CollectionProtocolEnums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LPLS.CollectionHardProtocol
{
    /// <summary>
    /// 协议基础
    /// </summary>
    public  interface IProtocol<T>
    {
        /// <summary>
        /// 打开协议
        /// </summary>
        /// <param name="obj"> 连接参数 主要原因是有的是串口有的是OPCUA等 连接字符串不统一 这里去统一起来</param>
        /// <param name="ProtocolType"> </param>
        /// <returns></returns>
        bool Open(T obj, LPLSConnlectionProtocolEnum ProtocolType);

        bool Close();
        /// <summary>
        /// 读取数据
        /// </summary>
        /// <typeparam name="T2"></typeparam>
        /// <param name="t2">参数名称 可能是array 也有可能string</param>
        /// <returns></returns>
        T2 SingleRead<T2>(string  address) ;

        List<T2> BatchRead<T2>(string[] addresses);


        bool SingleWrite(string address);

        bool BatchWrite(string[] addresses);
    }
}
